Skip to content

Conversation

@jnsdls
Copy link
Member

@jnsdls jnsdls commented Feb 14, 2025

TL;DR

Implemented dynamic gas sponsorship detection for chains through a new API endpoint

What changed?

  • Added a new API endpoint to fetch gas-sponsored chains
  • Removed hardcoded gas sponsorship flags from chain metadata
  • Created reusable getGasSponsoredChains function with 15-minute cache
  • Refactored chain metadata to dynamically apply gas sponsorship status and CTA
  • Moved API secret to environment constants

How to test?

  1. Set up the API_SERVER_SECRET environment variable
  2. Visit chain pages to verify gas sponsorship badges appear correctly
  3. Confirm gas sponsorship CTAs display for supported chains
  4. Verify the gas sponsorship status updates when chains are added/removed from the API response

Why make this change?

Moving gas sponsorship configuration to an API endpoint allows for dynamic updates without code changes and provides a single source of truth for sponsored chains across the platform. This reduces maintenance overhead and ensures consistency in gas sponsorship information.

@vercel
Copy link

vercel bot commented Feb 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2025 6:15am
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) Feb 14, 2025 6:15am
login ⬜️ Skipped (Inspect) Feb 14, 2025 6:15am
thirdweb_playground ⬜️ Skipped (Inspect) Feb 14, 2025 6:15am
wallet-ui ⬜️ Skipped (Inspect) Feb 14, 2025 6:15am

@changeset-bot
Copy link

changeset-bot bot commented Feb 14, 2025

⚠️ No Changeset found

Latest commit: 9a459d9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel vercel bot temporarily deployed to Preview – thirdweb_playground February 14, 2025 06:08 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui February 14, 2025 06:08 Inactive
@vercel vercel bot temporarily deployed to Preview – login February 14, 2025 06:08 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 February 14, 2025 06:08 Inactive
@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Feb 14, 2025
Copy link
Member Author

jnsdls commented Feb 14, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jnsdls jnsdls marked this pull request as ready for review February 14, 2025 06:08
@jnsdls jnsdls requested review from a team as code owners February 14, 2025 06:08
@codecov
Copy link

codecov bot commented Feb 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.86%. Comparing base (39a5b5c) to head (9a459d9).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6256   +/-   ##
=======================================
  Coverage   56.86%   56.86%           
=======================================
  Files        1166     1166           
  Lines       64523    64523           
  Branches     5226     5226           
=======================================
  Hits        36694    36694           
  Misses      27101    27101           
  Partials      728      728           
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from 39a5b5c
packages 55.08% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 46.3 KB (0%) 926 ms (0%) 2.3 s (-3.69% 🔽) 3.3 s
thirdweb (cjs) 121.89 KB (0%) 2.5 s (0%) 5.5 s (-8.82% 🔽) 7.9 s
thirdweb (minimal + tree-shaking) 5.6 KB (0%) 112 ms (0%) 205 ms (+6.96% 🔺) 317 ms
thirdweb/chains (tree-shaking) 506 B (0%) 10 ms (0%) 90 ms (+50.59% 🔺) 100 ms
thirdweb/react (minimal + tree-shaking) 19.29 KB (0%) 386 ms (0%) 697 ms (+78.28% 🔺) 1.1 s

@jnsdls jnsdls merged commit c8ef941 into main Feb 14, 2025
35 of 40 checks passed
@jnsdls jnsdls deleted the fetch_gas_sponsored_chains_from_API_instead_of_hardcoding branch February 14, 2025 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dashboard Involves changes to the Dashboard.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants